import matplotlib.pyplot as plt

# 用于处理中文
plt.rcParams['font.sans-serif'] = ['SimHei']

"""
调整图表与画布边缘间距：
    matplotlib.pyplot.subplots_adjust(left, right, top, bottom)
"""

x = [1, 2, 3, 4, 5, 6]
y = [10, 45, 35, 46, 7, 67]
plt.plot(x, y, marker='o')

# 添加文本标签
for a, b in zip(x, y):
    plt.text(a, b, b, ha='center', va='bottom', fontsize=12, color='r')

# 添加文本注释
plt.annotate('最大数', xy=(4, 46), xytext=(5, 46), arrowprops=dict(facecolor='r', shrink=0.05))

# 设置间距
plt.subplots_adjust(left=0.2, right=0.9, top=0.9, bottom=0.2)
plt.show()
